/*
 * BanBu_TitleView
 * @description 本文件提供导航条定制的title，上下两行
 * @package
 * @author 		***
 * @copyright
 * @version 		1.0
 * @description 本文件提供导航条定制的title，上下两行
 */

#import "BanBu_TitleView.h"

@implementation BanBu_TitleView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        positionLabel.text = NSLocalizedString(@"inTheLocation", nil);
        
    }
    return self;
}
+(BanBu_TitleView *)instanceView;
{
    return [[[NSBundle mainBundle] loadNibNamed:@"BanBu_TitleView" owner:nil options:nil] objectAtIndex:0];
}


-(void)setName:(NSString *)name
{
    _name = [name copy];
    nameLabel.text = _name;
    //修改：yinlinlin:2014/07/09,原因：BanBu_TitleView的宽度从240修改到160，因为太宽影响返回按钮的操作
    [nameLabel sizeToFit];
    
    if (nameLabel.frame.size.width > 200)
    {
        [nameLabel setFrame:CGRectMake(-20, nameLabel.frame.origin.y, 200, nameLabel.frame.size.height)];
    }

    nameLabel.center = CGPointMake(80, 12);
    //修改完成：yinlinlin
}
-(void)setPosition:(NSString *)position
{
    _position = [position copy];
    positionLabel.text = _position;
    //修改：yinlinlin:2014/07/09,原因：BanBu_TitleView的宽度从240修改到160，因为太宽影响返回按钮的操作，所以sizeToFit自适应宽度，中间center固定，既不会影响两边按钮，又不至显示不全
    [positionLabel sizeToFit];
    if (positionLabel.frame.size.width > 200)
    {
        [positionLabel setFrame:CGRectMake(-20, positionLabel.frame.origin.y, 200, positionLabel.frame.size.height)];
    }
    
    positionLabel.center = CGPointMake(80, 32);
    //修改完成：yinlinlin
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

- (void)dealloc {
    [nameLabel release];
    [positionLabel release];
    [super dealloc];
}
@end
